<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-voucherInfo-add">
			<div class="form-group">	
				<label class="col-sm-3 control-label">系统编号：</label>
				<div class="col-sm-8">
					<input id="sysId" name="sysId" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">系统名称：</label>
				<div class="col-sm-8">
					<input id="sysNm" name="sysNm" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">凭证编号：</label>
				<div class="col-sm-8">
					<input id="evoSn" name="evoSn" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">凭证名称：</label>
				<div class="col-sm-8">
					<input id="evoNm" name="evoNm" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">模板名称：</label>
				<div class="col-sm-8">
					<select id="modId" name="modId" class="form-control m-b" th:with="type=${@ModInfoServiceImpl.selectModInfoAll()}">
						<option th:each="dict : ${type}" th:text="${dict.modNm}" th:value="${dict.modId}" ></option>
					</select>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">备注：</label>
				<div class="col-sm-8">
					<input id="evoNote" name="evoNote" class="form-control" type="text">
				</div>
			</div>
		</form>
	</div>
    <div th:include="include::footer"></div>
    <script type="text/javascript">
		var prefix = ctx + "evo/voucherInfo";
		$("#form-voucherInfo-add").validate({
			rules:{
				evoNm:{
					required:true,
				},
			}
		});
		
		function submitHandler() {
	        if ($.validate.form()) {
	            add();
	        }
	    }
		
		function add() {
        	var sysId = $("input[name='sysId']").val();
        	var sysNm = $("input[name='sysNm']").val();
        	var evoSn = $("input[name='evoSn']").val();
        	var evoNm = $("input[name='evoNm']").val();
        	var modId = $("#modId option:selected").val();
        	var evoNote = $("input[name='evoNote']").val();
        	$.ajax({
        		cache : true,
        		type : "POST",
        		url : ctx + "evo/voucherInfo/add",
        		data : {
        			"sysId": sysId,
        			"sysNm": sysNm,
        			"evoSn": evoSn,
        			"evoNm": evoNm,
        			"modId": modId,
        			"evoNote": evoNote
        		},
        		async : true,
        		error : function(request) {
        			$.modal.alertError("系统错误");
        		},
        		success : function(data) {
        			$.operate.saveSuccess(data);
        		}
        	});
        }
	</script>
</body>
</html>
